package com.maben.s9002.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.maben.s9002.mapper.RoleMapper;
import com.maben.s9002.pojo.Role;
import com.maben.s9002.service.RoleService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements RoleService {
    @Override
    @Transactional(value = "mybatisTransactionManager")
    public void saveRole(Role role) throws Exception {
        if (role == null) {
            return;
        }
        if (role.getId() == null) {
            this.baseMapper.insert(role);
        } else {
            this.baseMapper.updateById(role);
        }
    }
}
